# coding: utf-8

from flask import Flask
from app.views.auth.index import ind
from app.views.auth.account import account
from app.views.auth.register import register
from app.views.func_list import user
from app.views.func_list import files
from app.views.upload import code
from app.views.chart import chart
from .configs.config import Config


def create_app():
    """
    创建Flask的应用对象：
        __name__: 表示当前的模块名字, 模块名，flask以这个模块所在的目录为总目录，默认这个目录中的static为静态目录，templates为模板目录
        static_url_path: 访问静态资源的url前缀, 默认值是static
        static_folder: 静态文件的目录，默认static
        template_folder: 模板文件的目录，默认是templates
    """
    app = Flask(__name__)
    app.config.from_object(Config)

    app.register_blueprint(account)
    app.register_blueprint(register)
    app.register_blueprint(ind)
    app.register_blueprint(user)
    app.register_blueprint(files)
    app.register_blueprint(code)
    app.register_blueprint(chart)

    return app
